/*
 * @Author: 陈俊升 761723995@qq.com
 * @Date: 2023-09-18 13:44:34
 * @LastEditors: 陈俊升 761723995@qq.com
 * @LastEditTime: 2024-03-07 14:45:26
 * @FilePath: /hr_new_vue3/src/apis/management/personnel/changeManagement/inductionManagement/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/* 人员 入职管理api */

import { ajaxService } from '@/utils/request';
import * as typeObj from './type';

const env = import.meta.env;
// const baseURL1 = env.VITE_API_BASE_URL;
const baseURL1 = env.VITE_DEV_BASE_URL;
const baseURL = env.VITE_DEV_BASE_URL;

/**
 * 修改人员入职状态
 * 1入职申请 2待入职 3预入职 4入职办理 5正式入职 6待离职 7离职 8放弃入职 9实习结束 10转正 11试用期 12人事异动 13离职申请 14放弃离职
 */
export function ChangeHumanInductionState(data: {
  ids: number[];
  type: number;
}) {
  return ajaxService(
    {
      url: '/hr/personnel_matters/roster/personnel/status',
      method: 'put',
      data,
      baseURL
    },
    {
      mode: 'success',
      message: '修改成功！'
    }
  );
}

/**
 * 获取入职申请签名
 *
 * duration: 持续时间
 */
export function PostApplySign(data: { duration?: number }) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/sign',
    method: 'post',
    data,
    baseURL: baseURL1
  });
}

/**
 * 验证签名有效期
 *
 * sign: 签名
 * timeStamp: 时间戳
 */
export function CheckApplySign(data: { sign: string; timeStamp: number }) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/check',
    method: 'post',
    data,
    noToken: true,
    baseURL: baseURL1
  });
}

/**
 * 入职申请审核状态修改
 * ids: 入职申请id
 * auditStatus 入职申请审核状态（1待审核2通过3拒绝）
 */
export function PutAuditEntryState(data: {
  ids: number[];
  auditStatus: number;
}) {
  return ajaxService({
    url: '/hr/personnel_matters/roster/personnel/audit',
    method: 'put',
    data,
    baseURL: baseURL1
  });
}

/**
 * 删除员工列表
 * ids: 人员id
 */
export function DelHumanList(data: { ids: number[] }) {
  return ajaxService(
    {
      url: '/hr/personnel_matters/roster/personnel/list',
      method: 'delete',
      data,
      baseURL: baseURL1
    },
    { message: '删除成功', mode: 'info' }
  );
}
